package com.globefrog.example.client;

import com.globefrog.example.ProviderServiceLocate;
import com.globefrog.example.request.ProviderUserRequest;
import com.globefrog.example.response.ProviderUserResponse;
import com.globefrog.framework.web.response.BaseResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author : Globe-Frog
 * @date : Create in 2021/7/8
 */
@FeignClient(value = ProviderServiceLocate.PROVIDER_SERVICE_NAME)
@RequestMapping(value = "/provider/user")
public interface ProviderClient {

  @RequestMapping(
      value = "/{id}",
      method = RequestMethod.POST,
      consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
      produces = MediaType.APPLICATION_JSON_UTF8_VALUE
  )
  @ResponseBody
  BaseResponse<ProviderUserResponse> getById(@PathVariable("id") String id);

  @RequestMapping(
      method = RequestMethod.POST,
      consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
      produces = MediaType.APPLICATION_JSON_UTF8_VALUE
  )
  @ResponseBody
  void saveUser(@RequestBody ProviderUserRequest request);
}
